package core.gui;

import core.input.Input;
import core.input.InputReceiver;

import java.awt.Graphics2D;
import java.awt.Rectangle;
import java.awt.event.KeyEvent;
import java.awt.event.MouseEvent;
import java.awt.geom.RectangularShape;


public abstract class Component implements InputReceiver
{
	
	protected RectangularShape boundingRect = new Rectangle(0, 0, 10, 10);
	protected Input input;
	protected boolean isVisible = true;
	
	public void setInput(Input input){
		this.input = input;
	}
	
	public void setPosition(int x, int y){
		boundingRect.setFrame(x, y, boundingRect.getWidth(), boundingRect.getHeight());
	}
	
	public void setSize(int width, int height){
		boundingRect.setFrame(boundingRect.getX(), boundingRect.getY(), width, height);
	}
	
	public void setVisible(boolean value){
		isVisible = value;
	}
	
	public void render(Graphics2D g){
		System.out.println("Render super");
		if(!isVisible){
			return;
		}
	}
	
	public void update(int deltaTime) {
		if(!isVisible){
			return;
		}
	}

	//@Override
	public void keyPressed(KeyEvent e) {
		if(!isVisible){
			return;
		}
	}

	//@Override
	public void keyReleased(KeyEvent e) {
		if(!isVisible){
			return;
		}
	}

	//@Override
	public void keyTyped(KeyEvent e) {
		if(!isVisible){
			return;
		}
	}

	//@Override
	public void mouseClicked(MouseEvent e) {
		if(!isVisible){
			return;
		}
	}

	//@Override
	public void mouseMoved(MouseEvent e) {
		if(!isVisible){
			return;
		}
	}

	//@Override
	public void mousePressed(MouseEvent e) {
		if(!isVisible){
			return;
		}
	}

	//@Override
	public void mouseReleased(MouseEvent e) {
		if(!isVisible){
			return;
		}
	}

}
